<?php
session_start();

include "config.php";

if (!isset($_SESSION['username']) or $_SESSION['password']=="") {
header("location:../index.php?pesan=Login Dulu Brooo...");
exit;
}else{
$usernamed = $_SESSION['username'];
$kuerilevel = mysql_query("select id_user, level from tbl_user where username = '$usernamed'");
while($datax = mysql_fetch_array($kuerilevel)){
	$leveling = $datax['level'];
	$idx = $datax['id_user'];
}
if($_SESSION['username'] == 'guest'){
	$leveling = 3;
}
?>
<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.tbl_border tr td {
	color: #FFF;
	font-weight:bold;
}
</style>
<script>
function weaponfunc(){
	window.location.href = 'index.php?page=weapon';
}
function charfunc(){
	window.location.href = 'index.php?page=char';
}
function itemfunc(){
	window.location.href = 'index.php?page=item';
}
function calfunc(){
	window.open('http://adam-pc:8080/cal/', '_blank');
}
function heuristikfunc(){
	window.location.href = 'index.php?page=heuristik';
}
function userfunc(){
	window.location.href = 'index.php?page=user';
}
</script>
<title>Point Blank Shop</title>
<body>
<div class="judul"><marquee behavior="scroll" scrollamount="5"><font color="#333333">To All, bagi teman teman yang melihat Senjata, Item, Char kita tidak tercatat di aplikasi ini, bisa dibantu teman-teman semua menambahkan kekurangan tersebut. Terima Kasih</font></marquee></div>
<table width="100%" border="1" cellpadding="3" cellspacing="5" class="tbl_border">
  <tr>
    <td colspan="5" bgcolor="#3366FF">Selamat Datang, <?=$_SESSION['username']; ?></td>
    <td colspan="2" align="right" bgcolor="#3366FF"><?php if($leveling == 3){ echo""; }else{ ?><a href='index.php?page=edit_user&&id=<?=$idx;?>'>Change Password</a> ||<?php } ?><a href='logout.php'> Logout</a></td>
  </tr>
  <tr>
    <td bgcolor="#3366FF" align="center" onClick="weaponfunc();"><a href="index.php?page=weapon">PB Weapon</a></td>
    <td bgcolor="#3366FF" align="center" onClick="charfunc();"><a href="index.php?page=char">PB Character</a></td>
    <td bgcolor="#3366FF" align="center" onClick="itemfunc();"><a href="index.php?page=item">PB Item</a></td>
    <td bgcolor="#3366FF" align="center" onClick="calfunc();">PB Calender</td>
	<td bgcolor="#3366FF" align="center" onClick="heuristikfunc();"><a href="index.php?page=heuristik">PB Heuristik</a></td>
    <td bgcolor="#3366FF" align="center" onClick="userfunc();"><a href="index.php?page=user">Control Panel</a></td>
  </tr>
  <tr>
    <td height="500px" colspan="7" align="center" valign="top" bgcolor="#000000">
	<?php  
	if(isset($_REQUEST['page'])){
		include("$_REQUEST[page].php");
	}else{
		echo("Selamat datang di aplikasi Point Blank Shop");
	}
	?></td>
  </tr>
  <tr>
    <td colspan="7" bgcolor="#000000" align="center">Copyright &copy; Point Blank Team 2014 Ver. 1.6 (Repair PB Item and Add PB Item system)</td>
  </tr>
</table>

<?php
} 
?>
</body>